#!usr/bin/env python  
# -*- coding:utf-8 _*-
""" 
@author:robot
@file: api07_inspects.py 
@version:
@time: 2022/04/18 
"""
from TapClientCore.T02_tm_api.v2_api.v2_api_base import *


class Api07InspectsUrl(V2ApiUrlBase):
    url_inspects = api_joint(V2ApiUrlBase().server, INSPECTS)
    url_inspects_update = api_joint(url_inspects, INSPECTS_UPDATE)
    url_inspects_findone = api_joint(url_inspects, INSPECTS_FIND_ONE)


class Api07Inspects(V2ApiBase):

    def get_inspects(self, filter):
        response = self.tapclient(
            self.get,
            Api07InspectsUrl.url_inspects
            + self.access_token
            + self.filter(filter)
        )
        return response

    def post_inspects(self, payload):
        response = self.tapclient(
            self.post,
            Api07InspectsUrl.url_inspects
            + self.access_token,
            json=payload
        )
        return response

    def post_inspects_update(self, where, payload):
        response = self.tapclient(
            self.post,
            Api07InspectsUrl.url_inspects_update
            + self.where(where)
            + self.access_token2,
            json=payload
        )
        return response

    def delete_inspects_by_id(self, inspect_id):
        response = self.tapclient(
            self.delete,
            api_joint(Api07InspectsUrl.url_inspects, inspect_id)
            + self.access_token
        )
        return response

    def get_inspects_find_one(self, filter):
        response = self.tapclient(
            self.get,
            Api07InspectsUrl.url_inspects_findone
            + self.access_token
            + self.filter(filter)
        )
        return response

    def patch_inspects(self, payload):
        response = self.tapclient(
            self.patch,
            Api07InspectsUrl.url_inspects
            + self.access_token,
            json=payload
        )
        return response
